<? /* license

BilugCMS (http://www.bilug.it) - Content Management System for dynamic web sites
Copyright (C) 2005-2008  Federico Villa and Alessio Loro Piana

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

For reference, contact bilugcms@vilnet.it


license */ ?>
<?
require_once("auth.php");
require_once("../utility/funzioni.php");
$id = $_GET['id'];
$argo = apici($_GET['argo']);
 echo "<div class=\"contenitore\">";
 $dir='../gals/'.$argo.'/'.$id;    
 echo "<h5>FILES CARICATI NELLA GALLERIA IMMAGINI: $argo</h5><br/>";
 echo "<form name=\"foto\" method=\"POST\" action=\"insert_desc_query.php\" enctype=\"multipart/form-data\">";
 echo "<input type=\"hidden\" name=\"id\" value=\"$id\"/>";
 echo "<input type=\"hidden\" name=\"argo\" value=\"$argo\"/>";
 function tree( $dir,$liv,$argo,$id )
   {      
   $j=0;
   if( is_dir( $dir ) )
     {
       foreach( scandir( $dir) as $item )
       {
       	
         if( !strcmp( $item, '.' ) || !strcmp( $item, '..' ) || !strcmp( $item, 'index.php' )|| strstr ( $item,'.txt' ) )
           continue;       
           if(is_dir($dir."/".$item)==TRUE)
           {
           echo "<hr/>";
           for ($i=0;$i<$liv;$i++)
       		echo "<div class=\"float20\">&nbsp;</div>\n";
           echo "<div class=\"float300\"><h3>Elenco files dell'utente: $item</h3></div>";
           echo "<div class=\"azzerafloat\"></div>";              
           tree( $dir. "/" . $item, $liv+1,$argo,$id);
           echo "<div class=\"azzerafloat\"></div>"; 
           }
           else
           {
           for ($i=0;$i<$liv;$i++)
       		echo "<div class=\"float20\">&nbsp;</div>\n"; 	
       		$str2="SELECT descrizione FROM galleria where immagine='".$id."/".$item."'";	
				$risultato2=mysql_query($str2);
				if (mysql_num_rows($risultato2)>0)      	
       			$controlimg=mysql_fetch_row($risultato2);
       		else
       			$controlimg="";
           echo "<div class=\"float200\"> <a href=\"$dir/$item\">
       		<img valign=\"middle\" src=\"../utility/thump.php?w=140&amp;h=140&amp;file=".$dir.'/'.$item."\"
       		 alt=\"".$item."\"/></div>\n </a>\n";
           echo "<div class=\"float700\">Nome Immagine: $item<br/>";
           echo "<input type=\"hidden\" name=\"item$j\"  value=\"$item\"/>";
 				  echo "<textarea rows=\"4\" cols=\"30\" name=\"titolo$j\" 
 				  class=\"fotodesc\" />$controlimg[0]</textarea><br/>";
                  echo "</div>\n";              
           echo "<div class=\"azzerafloat\"></div>";
           $j++;
           }
       }   
     }
	 echo "<br />";
     echo "<hr/>";
     
   }
   
 tree ($dir,0,$argo,$id);
 echo "<br />";
 echo "<input class=\"medio\" type=\"submit\" value=\"Salva Cambiamenti\"/>";
 echo" <input type=\"button\" class=\"medio\" name=\"Annulla\" value=\"Annulla\" 
 onclick=\"javascript:history.go(-1)\" />";
 echo "</form> </div>";  
?>  
